from appium import webdriver
class Appdriver():
    def get_driver(self):
        try:
            self.desired_caps = {}
            # 设备信息
            self.desired_caps['platformName'] = 'Android'
            self.desired_caps['platformVersion'] = '7.1.2'
            self.desired_caps['deviceName'] = '127.0.0.1:62001'
            # app的信息
            self.desired_caps['appPackage'] = 'com.tpson.firecontrolv3'
            self.desired_caps['appActivity'] = 'com.tpson.login_module.view.LoginActivity'
            self.desired_caps['unicodeKeyboard'] = True
            self.desired_caps['resetKeyboard'] = True
            self.desired_caps['automationName'] = 'Appium'
            self.desired_caps['noReset'] = True
            self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', self.desired_caps)
            #self.driver.implicitly_wait(5)
            return self.driver
        except Exception as e:
            raise e
